﻿using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
public class ClickEvent : MonoBehaviour
{

    [SerializeField] private float SellMoney = 0f;
    [SerializeField] private float UpgradeMoney = 0f;
    public GameObject turretPrefab_more;
    private GameObject turretInstance;


    public void UpgradeButtonClicked()
    {
        if (MoneyManager.Money >= UpgradeMoney)
        {
            Vector3 CurrentPosition = transform.position;
            Destroy(gameObject);
            turretInstance = Instantiate(turretPrefab_more, CurrentPosition, Quaternion.identity);
            MoneyManager.Money -= UpgradeMoney;
        }
        else
        {
            return;
        }
    }

    public void SellButtonClicked()
    {
        Destroy(gameObject);
        MoneyManager.Money += SellMoney;
    }
}
